package ACM.red;

/**
 * @Author wwk
 * @DATE 2022/8/28 17:15
 */
import java.util.*;

public class third {

    static int[][] relations;  //关系无向图
    static boolean[] used;  //是否使用
    static int n;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();  //员工数量
        relations = new int[n+1][n+1];  //无向图
        //无向图入值
        for (int i = 1; i < n; i++){
            int k = scanner.nextInt();
            relations[k][i+1] = 1;
            relations[i+1][k] = 1;
        }
        int count = 0;  //统计互相构成朋友的对数
        int[] p = new int[n+1];
        used = new boolean[n+1];
        for (int i = 1; i <= n; i++){
            if(match(i,p)){
                count++;
            }
        }
        System.out.println(count/2);
    }

    static boolean match( int i, int[] p){
        for (int j = 1; j < n; j++) {
            if(relations[i][j]==1 && !used[j]){
                used[j] = true;
                if(p[j]==0 || match(p[j], p)){
                    p[j] = i;
                    return true;
                }
            }
        }
        return false;
    }
}
